Hewlett Packard development

Contents|Index|Previous|Next

Hewlett Packard development

The following documentation discusses cross-development with the Hewlett Packard processors.

- Compiling for HP targets
- Assembler options for HP targets
- Debugging for HP targets

For more information, see HP Precision Architecture Instruction Set Manual (v1.1, 3rd edition).
See Host naming conventions for naming conventions for the specific host platform.
Host naming conventions

Canonical triplet name | Platform
`hppa1.1-hp-hpux10` | HP 9000/700, HP-UX B.10.01
`hppa1.1-hp-hpux10.20` | HP 9000/700, HP-UX B.10.20
`hppa1.1-hp-hpux11` | HP 9000/700, HP-UX B.11.0

### Compiling for HP targets

The following `-m` options are defined for the HPPA family of computers.
`-mpa-risc-1-0`

> Generate code for a PA 1.0 processor.

`-mpa-risc-1-1`

> Generate code for a PA 1.1 processor.

`-mbig-switch`

> Generate code suitable for big switch tables. Use this option only if the assembler/linker complain about out of range branches within a switch table.

`-mjump-in-delay`

> Fill delay slots of function calls with unconditional jump instructions by modifying the return pointer for the function call to be the target of the conditional jump.

`-mdisable-fpregs`

> Prevent floating point registers from being used in any manner. This is necessary for compiling kernels which perform lazy context switching of floating point registers. If you use this option and attempt to perform floating point operations, the compiler will abort.

`-mdisable-indexing`

> Prevent the compiler from using indexing address modes. This avoids some rather obscure problems when compiling MIG generated code under MACH.

`-mno-space-regs`

> Generate code that assumes the target has no space registers.

> This allows GCC to generate faster indirect calls and use unscaled index address modes. Such code is suitable for level 0 PA systems and kernels.

`-mfast-indirect-calls`

> Generate code that assumes calls never cross space boundaries. This allows GCC to emit code which performs faster indirect calls.

> This option will not work in the presence of shared libraries or nested functions.

`-mspace`

> Optimize for space rather than execution time. Currently this only enables out of line function prologues and epilogues. This option is incompatible with PIC code generation and profiling.

`-mlong-load-store`

> Generate 3-instruction load and store sequences as some-times required by the HP/UX 10 linker. This is equivalent to the `+k` option to the HP compilers.

`-mportable-runtime`

> Use the portable calling conventions proposed by HP for ELF systems.

`-mgas`

> Enable the use of assembler directives only GAS understands.

`-mschedule=cpu type`

> Schedule code according to the constraints for the machine type (signified by the `cpu type`). The choices for `cpu type` are `700` for `7n0` machines, `7100` for `7n5` machines, and `7100` for `7n2` machines. `7100` is the default for `cpu type`.

> Note:
> The `7100LC` scheduling information is incomplete and using `7100LC` often leads to bad schedules. For now it’s probably best to use `7100` instead of `7100LC` for the `7n2` machines.

`-mlinker-opt`

> Enable the optimization pass in the HP/UX linker.

> Note:
> This makes symbolic debugging impossible. It also triggers a bug in the HP/UX 8 and HP/UX 9 linkers in which they give bogus error messages when linking some programs.

`-msoft-float`

> Generate output containing library calls for floating point.

> > Warning:

> > The requisite libraries are not available for all HPPA targets. Normally the facilities of the machine's usual C compiler are used, but this cannot be done directly in cross-compilation. You must make your own arrangements to provide suitable library functions for cross-compilation. The embedded target `hppa1.1-*-pro` does provide software floating point support.

> `-msoft-float` changes the calling convention in the output file; therefore, it is only useful if you compile all of a program with this option. In particular, you need to compile `libgcc.a`, the library that comes with GCC, with `-msoft-float` in order for this to work.

### Assembler options for HP targets

To use the GNU assembler to assemble GCC output, configure GCC with the switch, `--with-gnu-as` (in GNUPro Toolkit distributions) or with the `-mgas` option.
`-mgas`

> Compile using `as` to assemble GCC output.

> As a back end for GNU CC ,`as` has been thoroughly tested and should work extremely well for the HPPA targets. It has been tested only minimally on hand-written assembly code and no one has tested it much on the assembly output from the HP compilers.

> The format of the debugging sections has changed since the original `as` port (version 1.3`X`) was released; therefore, you must rebuild all HPPA objects and libraries with the new assembler so that you can debug the final executable.

> The HPPA `as` port generates a small subset of the relocations available in the SOM and ELF object file formats. Additional relocation support will be added as it becomes necessary.

`as`has no machine-dependent command-line options for the HPPA.

#### HPPA syntax

The assembler syntax closely follows the HPPA instruction set reference manual; assembler directives and general syntax closely follow the HPPA assembly language reference manual, with a few noteworthy differences.
First, a colon may immediately follow a label definition. This is simply for compatibility with how most assembly language programmers write code.
Some obscure expression parsing problems may affect hand written code which uses the `spop`instructions, or code which makes significant use of the !line separator.

`as` is much less forgiving about missing arguments and other similar oversights than the HP assembler. `as`notifies you of missing arguments as syntax errors; this is regarded as a feature, not a bug.

Special characters for HPPA targets include the following.

`;` is the line comment character.

`!` can be used instead of a newline to separate statements.

Since `$` has no special meaning, you may use it in symbol names.

Finally, `as`allows you to use an external symbol without explicitly importing the symbol.

> Warning:
> In the future this allowance will be an error for HPPA targets.

#### HPPA floating point

The HPPA family uses IEEE floating-point numbers.

#### HPPA assembler directives

`as` for the HPPA supports many additional directives for compatibility with the native assembler. The following documentation only briefly describes them. For detailed information on HPPA-specific assembler directives, see HP9000 Series 800 Assembly Language Reference Manual (HP 92432-90001).
`as` does not support the following assembler directives described in the HP manual:

> `.endm listoff macro`

> `.enter liston`
> `.leave locct`

Beyond those implemented for compatibility, `as` supports one additional assembler directive for the HPPA: `.param`. It conveys register argument locations for static functions. Its syntax closely follows the `.export` directive.
The following are the additional directives in `as` for the HPPA:

`.block n`

`.blockz n`

> Reserve `n`-bytes of storage, and initialize them to zero.

`.call`

> Mark the beginning of a procedure call. Only the special case with no arguments is allowed.

`.callinfo [param=value, ...][flag, ...]`

> Specify a number of parameters and flags that define the environment for a procedure. `param` may be any of frame (frame size), `entry_gr` (end of general register range), `entry_fr` (end of float register range), `entry_sr` (end of space register range). The values for `flag` are `calls` or `caller` (`proc` has subroutines), `no_calls` (`proc` does not call subroutines), `save_rp` (preserve return pointer), `save_sp` (`proc` preserves stack pointer), `no_unwind` (do not unwind this `proc`), `hpux_int` (`proc` is interrupt routine).

`.code`

> Assemble into the standard section called `$TEXT$`, subsection `$CODE$`.

`.copyright "string"`

> In the SOM object format, insert `string` into the object code, marked as a copyright string.

`.enter`

> Not yet supported; the assembler rejects programs containing this directive.

`.entry`

> Mark the beginning of a procedure.

`.exit`

> Mark the end of a procedure.

`.export name[,typ][,param=r]`

> Make a procedure `name` available to callers. `typ`, if present, must be one of `absolute`, `code` (ELF only, not SOM), `data`, `entry`, `data`, `entry`, `millicode`, `plabel`, `pri_prog`, or `sec_prog`.

> `param`, if present, provides either relocation information for the procedure arguments and result, or a privilege level. `param`may be `argwn` (where `n` ranges from 0 to 3, and indicates one of four one-word arguments); `rtnval` (the procedure's result); or `priv_lev` (privilege level). For arguments or the result, `r` specifies how to relocate, and must be one of `no`(not relocatable), `gr`(argument is in general register), `fr`(in floating point register), or ``fu`' (upper half of float register). For `priv_lev`, `r` is an integer.

`.half n`

> Define a two-byte integer constant `n`; synonym for the portable `as` directive, `.short`.

`.import name[,typ]`

> Converse of `.export`; make a procedure available to call. The arguments use the same conventions as the first two arguments for `.export`.

`.label name`

> Define `name` as a label for the current assembly location.

`.leave`

> Not yet supported; the assembler rejects programs containing this directive.

`.origin lc`

> Advance location counter to `lc`. Synonym for the `{No value for "as"}`portable directive `.org`.

`.param name[,typ][,param=r]`

> Similar to `.export`, but used for static procedures.

`.proc`

> Use preceding the first statement of a procedure.

`.procend`

> Use following the last statement of a procedure.

`label.reg expr`

> Synonym for `.equ`; define `label` with the absolute expression, `expr`, as its value.

`.space secnam[,params]`

> Switch to section `secnam`, creating a new section by that name if necessary. You may only use `params`when creating a new section, not when switching to an existing one. `secnam` may identify a section by number rather than by name. If specified, the list `params` declares attributes of the section, identified by keywords. The keywords recognized are `spnum=exp`(identify this section by the number, `exp`, an absolute expression), `sort=exp` (order sections according to this sort key when linking; `exp` is an absolute expression), `unloadable` (section contains no loadable data), `notdefined` (this section defined elsewhere), and `private` (data in this section not available to other programs).

`.spnum secnam`

> Allocate four bytes of storage, and initialize them with the section number of the section named `secnam`. (You can define the section number with the HPPA `.space` directive.)

`.string "str"`

> Copy the characters in the string, `str`, to the object file.

> > Warning:

> > The HPPA version of `.string` differs from the usual `as` definition: it does not write a zero byte after copying `str`.

`.stringz "str"`

> Like `.string`, but appends a zero byte after copying `str` to object file.

### Debugging for HP targets

For HPPA targets, GDB is called with the following input; see Host naming conventions for the actual canonical name for your platform to replace with `<canonical triplet>`.

> >     <canonical triplet> -gdb

GDB needs to know the following specifications.

- Specifications for what serial device connects your host to your HP board (the first serial device available on your host is the default).
- Specifications for what speed to use over the serial device (if you are using a Unix host).

Top|Contents|Index|Previous|Next